
<script type="text/javascript" charset="utf-8">


		var hardwarestatus_id;
		var department_id;
		var opersgroup_id;
		var opersgroupproject_id;
		var applicationtype_id;
		var os_id;
		$(function(){
			
			//状态信息
			hardwarestatus_id = $('#hardwarestatus_id').combobox({
				url:'/devicespost/hardwarestatusinfo',
				valueField:'id',
				textField:'hardwarestatus_name',
				editable:false,
				required:true,
				panelHeight:'150',
				value:'{{=hardwarestatus_id}}'
			});
			
			department_id = $('#department_id').combobox({
				  url:'/operationpost/departmentinfo',
				  valueField:'id',
				  textField:'department_name',
				  editable:false,
				  required:false,
				  panelHeight:'150',
				  value:'{{=department_id}}',
				  onSelect:function(record){
					  opersgroupproject_id.combobox('clear');
					  applicationtype_id.combobox().combobox('clear');
					  opersgroup_id.combobox({
						  url:'/operationpost/opersgroupinfo?id='+record.id,
						  //method:'get',
						  valueField:'id',
						  textField:'opersgroup_name',
						  editable:false,
						  panelHeight:'150',
						  required:false,
						  onSelect:function(opersgroup_record){
							  opersgroupproject_id.combobox('clear');
							  applicationtype_id.combobox().combobox('clear');
							  opersgroupproject_id.combobox({
								  url:'/operationpost/opersgroupprojectinfo?id='+opersgroup_record.id,
								  valueField:'id',
								  textField:'ogproject_name',
								  editable:false,
								  panelHeight:'150',
								  required:false,
								  onSelect:function(record){
									  applicationtype_id.combobox({
										  url:'/operationpost/applicationtypeinfo?id='+record.id,
										  valueField:'id',
										  textField:'applicationtype_name',
										  editable:false,
										  panelHeight:'150',
										  required:false
									  }).combobox('clear');
								  }
							  }).combobox('clear');	
						  }

					  }).combobox('clear');
				  }
			}).combobox('clear');
			
			opersgroupproject_id = $('#opersgroupproject_id').combobox({
				url:'/operationpost/opersgroupprojectinfo?id={{=opersgroup_id}}',
				valueField:'id',
				textField:'ogproject_name',
				editable:false,
				required:false,
				value:'{{=opersgroupproject_id}}'
			});
			opersgroup_id = $('#opersgroup_id').combobox({
				url:'/operationpost/opersgroupinfo?id={{=department_id}}',
				valueField:'id',
				textField:'opersgroup_name',
				editable:false,
				required:false,
				value:'{{=opersgroup_id}}'
			});
			
			applicationtype_id = $('#applicationtype_id').combobox({
				url:'/operationpost/applicationtypeinfo?id={{=opersgroupproject_id}}',
				valueField:'id',
				textField:'applicationtype_name',
				editable:false,
				required:false,
				value:'{{=applicationtype_id}}'
			});
			
			
			//网卡类型
			$('#ethernet_type1').combobox({
				valueField: 'id',
				textField: 'value',
				data: [{
					id: '0',
					value: '虚拟'
				},{
					id: '1',
					value: '物理'
				}],
				panelHeight:'50',
				value:'{{=ethernet_type1}}'
			});
			$('#ethernet_type2').combobox({
				valueField: 'id',
				textField: 'value',
				data: [{
					id: '0',
					value: '虚拟'
				},{
					id: '1',
					value: '物理'
				}],
				panelHeight:'50',
				value:'{{=ethernet_type2}}'
			});
			$('#ethernet_type3').combobox({
				valueField: 'id',
				textField: 'value',
				data: [{
					id: '0',
					value: '虚拟'
				},{
					id: '1',
					value: '物理'
				}],
				panelHeight:'50',
				value:'{{=ethernet_type3}}'
			});
			$('#ethernet_type4').combobox({
				valueField: 'id',
				textField: 'value',
				data: [{
					id: '0',
					value: '虚拟'
				},{
					id: '1',
					value: '物理'
				}],
				panelHeight:'50',
				value:'{{=ethernet_type4}}'
			});			
			$('#ethernet_type5').combobox({
				valueField: 'id',
				textField: 'value',
				data: [{
					id: '0',
					value: '虚拟'
				},{
					id: '1',
					value: '物理'
				}],
				panelHeight:'50',
				value:'{{=ethernet_type5}}'
			});
			
			os_id = $('#os_id').combobox({
				url:'/devicespost/operatingsysteminfo',
				valueField:'id',
				textField:'os_info',
				editable:false,
				panelHeight:'150',
				value:'{{=os_id}}'
				
			});
			
			$('input[title]').qtip({
				 show: 'focus',
				 hide: 'blur',
				 style: {
						classes: 'qtip-blue qtip-bootstrap'
					},
				 content: {
						//text: 'I really like owls!',
						title: '示例(不要带单位)'
					},
				 position: {
					//my: 'top left',  // Position my top left...
					at: 'bottom center', // at the bottom right of...
					//target: $('input[title]') // my target
				}
			 });
									
		});

		function clearapp(){
			//清除应用主题相关
			$('#department_id').combobox('clear');
			$('#opersgroup_id').combobox('clear');
			$('#opersgroupproject_id').combobox('clear');
			$('#applicationtype_id').combobox('clear');
		}

		function cleareth(num){
			//清除网络配置，参数:num 清除第几个
			$('#ethernet_type' + num).combobox('clear');
			$('#ethernet_dev_name' + num).val('');
			$('#ethernet_physical_interface' + num).val('');
			$('#ethernet_ip' + num).val('');
			$('#ethernet_mac' + num).val('');
			$('#ethernet_mip' + num).val('');
			$('#switch_id' + num).combobox('clear');
			$('#switchport_id_port' + num).val('');
		}
</script>

<div style="padding: 5px;">
	<form method="post">
    	<input type="hidden" name="id" />
		<table class="tableForm" id="tb" name="tb" >
            <tr>
				<th style="width: 80px;">宿主机IP</th>
				<td><input name="parasitifer_ip" class="easyui-validatebox" data-options="required:'true'" data-options="validType:'ip'" value="{{=parasitifer_ip}}" style="width: 400px;" />
				</td>
			</tr>
           <tr id="tr_server_cpu">
				<th style="width: 80px;">CPU信息</th>
				<td><input id="server_cpu" name="server_cpu" class="easyui-validatebox" style="width: 400px;" data-options="validType:'cpuv'" value="{{=cpu}}" title="1<br>填写核数"/>
				</td>
			</tr>
           <tr id="tr_server_mem">
				<th style="width: 80px;">内存信息</th>
				<td><input id="server_mem" name="server_mem" class="easyui-validatebox" style="width: 400px;" data-options="validType:'memv'" value="{{=mem}}" title="512<br>2G<br>内存大小不写单位默认M"/>
				</td>
			</tr>
           <tr id="tr_server_disk">
				<th style="width: 80px;">硬盘信息</th>
				<td><input id="server_disk" name="server_disk" class="easyui-validatebox" style="width: 400px;" data-options="validType:'diskv'" value="{{=disk}}" title="100<br>100T<br>硬盘大小不写单位默认G"/>
				</td>
			</tr>
           
			<tr>
				<th style="width:80px;">操作系统</th>
				<td>
					<input style="line-height:26px;border:1px solid #ccc;width:130px" class="easyui-combobox" 
					name="os_id" id="os_id" />
					<a href="javascript:void(0);" onclick="$('#os_id').combobox('clear');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a>
				</td>
			</tr>
            <tr>
				<th style="width: 80px;">主机名</th>
				<td><input name="system_hostname" value="{{=system_hostname}}" class="easyui-validatebox" style="width: 400px;" />
				</td>
			</tr>			
			<tr>
				<th style="width: 80px;">系统分区</th>
				<td colspan="3">
					<textarea name="system_partition" style="height: 60px;width: 97%;">{{=system_partition}}</textarea>
				</td>
			</tr> 
			<tr>
                  <th style="width:80px;">状态信息</th>
                  <td>
                  <input style="line-height:26px;border:1px solid #ccc;width:130px" class="easyui-combobox" 
                        name="hardwarestatus_id" id="hardwarestatus_id" />
                  </td>
			</tr>
            <tr>
				<th style="width: 80px;">应用主题</th>
				<td>
					<input style="line-height:26px;border:1px solid #ccc;width:130px" class="easyui-combobox" 
                        data-options="required:false" name="department_id" id="department_id" />                    
                    <input style="line-height:26px;border:1px solid #ccc;width:120px" class="easyui-combobox" 
                        data-options="required:false" name="opersgroup_id" id="opersgroup_id" />
                    <input style="line-height:26px;border:1px solid #ccc;width:120px" class="easyui-combobox" 
                        data-options="required:false" name="opersgroupproject_id" id="opersgroupproject_id" />
                	<input style="line-height:26px;border:1px solid #ccc;width:150px" class="easyui-combobox" 
                		data-options="required:false" id="applicationtype_id" name="applicationtype_id"/>
                	<a href="javascript:void(0);" onclick="clearapp();"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a>
				</td>
			</tr>
			<tr>
				<th style="width: 80px;">网卡接入配置</th>
				<td>
                	<table>
                	  <thead><tr><td>类型</td><td>设备名</td><td>物理接口</td><td>ip地址</td><td>映射IP</td></tr></thead>
  <tbody>
    				<tr>
                    	<td><input id="ethernet_type1" class="easyui-combobox" name="ethernet_type1" style="width:50px;"/></td>
                        <td><input name="ethernet_dev_name1" id="ethernet_dev_name1" value="{{=ethernet_dev_name1}}" class="easyui-validatebox" style="width: 50px;" /></td>
                        <td><input name="ethernet_physical_interface1" id="ethernet_physical_interface1" value="{{=ethernet_physical_interface1}}" class="easyui-numberbox" style="width: 50px;" /></td>
                     	<td><input name="ethernet_ip1" id="ethernet_ip1" value="{{=ethernet_ip1}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/></td>
                        <td><input name="ethernet_mip1" id="ethernet_mip1" value="{{=ethernet_mip1}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/><a href="javascript:void(0);" onclick="cleareth('1');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a></td>
                     </tr>
                     <tr>
                    	<td><input id="ethernet_type2" class="easyui-combobox" name="ethernet_type2" style="width:50px;"/></td>
                        <td><input name="ethernet_dev_name2" id="ethernet_dev_name2" value="{{=ethernet_dev_name2}}" class="easyui-validatebox" style="width: 50px;" /></td>
                        <td><input name="ethernet_physical_interface2" id="ethernet_physical_interface2" value="{{=ethernet_physical_interface2}}" class="easyui-numberbox" style="width: 50px;" /></td>
                     	<td><input name="ethernet_ip2" id="ethernet_ip2" value="{{=ethernet_ip2}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/></td>
                        <td><input name="ethernet_mip2" id="ethernet_mip2" value="{{=ethernet_mip2}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/><a href="javascript:void(0);" onclick="cleareth('2');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a></td>
                     </tr>
                     <tr>
                    	<td><input id="ethernet_type3" class="easyui-combobox" name="ethernet_type3" style="width:50px;"/></td>
                        <td><input name="ethernet_dev_name3" id="ethernet_dev_name3" value="{{=ethernet_dev_name3}}" class="easyui-validatebox" style="width: 50px;" /></td>
                        <td><input name="ethernet_physical_interface3" id="ethernet_physical_interface3" value="{{=ethernet_physical_interface3}}" class="easyui-numberbox" style="width: 50px;" /></td>
                     	<td><input name="ethernet_ip3" id="ethernet_ip3" value="{{=ethernet_ip3}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/></td>
                        <td><input name="ethernet_mip3" id="ethernet_mip3" value="{{=ethernet_mip3}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/><a href="javascript:void(0);" onclick="cleareth('3');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a></td>
                     </tr>
                     <tr>
                    	<td><input id="ethernet_type4" class="easyui-combobox" name="ethernet_type4" style="width:50px;"/></td>
                        <td><input name="ethernet_dev_name4" id="ethernet_dev_name4" value="{{=ethernet_dev_name4}}" class="easyui-validatebox" style="width: 50px;" /></td>
                        <td><input name="ethernet_physical_interface4" id="ethernet_physical_interface4" value="{{=ethernet_physical_interface4}}" class="easyui-numberbox" style="width: 50px;" /></td>
                     	<td><input name="ethernet_ip4" id="ethernet_ip4" value="{{=ethernet_ip4}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/></td>
                        <td><input name="ethernet_mip4" id="ethernet_mip4" value="{{=ethernet_mip4}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/><a href="javascript:void(0);" onclick="cleareth('4');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a></td>
                     </tr>
                     <tr>
                    	<td><input id="ethernet_type5" class="easyui-combobox" name="ethernet_type5" style="width:50px;"/></td>
                        <td><input name="ethernet_dev_name5" id="ethernet_dev_name5" value="{{=ethernet_dev_name5}}" class="easyui-validatebox" style="width: 50px;" /></td>
                        <td><input name="ethernet_physical_interface5" id="ethernet_physical_interface5" value="{{=ethernet_physical_interface5}}" class="easyui-numberbox" style="width: 50px;" /></td>
                     	<td><input name="ethernet_ip5" id="ethernet_ip5" value="{{=ethernet_ip5}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/></td>
                        <td><input name="ethernet_mip5" id="ethernet_mip5" value="{{=ethernet_mip5}}" class="easyui-validatebox" data-options="validType:'ip'" style="width:110px;"/><a href="javascript:void(0);" onclick="cleareth('5');"><span class="ext-icon-cross" title="清空" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span></a></td>
                     </tr>
  </tbody>
                     </table>
				</td>
			</tr>
            <tr>
				<th style="width: 80px;">备注</th>
				<td colspan="3"><textarea name="comment" style="height: 50px;width: 97%;"></textarea>
				</td>
			</tr>          
		</table>
	</form>
</div>